import { http } from "@/utils/http";

export type ListResult = {
  code: number;
  data: {
    count: number;
    data: [
      {
        id: string;
        userId: string;
        phone: string;
        education: number;
        age: string;
        name: string;
        sex: string;
        desiredOccupation: string;
        fileId: string;
        createTime: Date;
        updateTime: Date;
      }
    ]
  };
  msg: string;
};

export type Result = {
  code: number;
  data: any;
  msg: string;
};

export type AddResult = {
  code: number;
  data: {
    id: string;
  };
  msg: string;
};

export type ResumeResult = {
  code: number;
  data: {
    id: string;
    userId: string;
    phone: string;
    education: number;
    age: string;
    name: number;
    sex: string;
    desiredOccupation: string;
    fileId: string;
    createTime: Date;
    updateTime: Date;
  };
  msg: string;
};


export const getList = (params?: object) => {
  return http.request<ListResult>("get", "/api/ordinary/resume/list", { params });
};
export const get = (params?: object) => {
  return http.request<ResumeResult>("get", "/api/ordinary/resume/" + params);
};
export const add = (data?: object) => {
  return http.request<AddResult>("post", "/api/ordinary/resume", { data });
};
export const update = (data?: object) => {
  return http.request<Result>("put", "/api/ordinary/resume/update", { data });
};
export const deleted = (params?: object) => {
  return http.request<Result>("delete", "/api/ordinary/resume/" + params);
};
